package com.example.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class UserController {
    @RequestMapping("/save")
    @ResponseBody
    public String save(){
        System.out.println("springmvc save");
        return "{'skd':'ds'}";
    }

    @RequestMapping("/delete")
    @ResponseBody
    public String delete(){
        System.out.println("springmvc save");
        return "{'delete':'SpringMvc'}ooooooo";
    }

    //一普通参数
    @RequestMapping("/pt1")
    @ResponseBody
    public String pt1(String name,int age){
        System.out.println("普通参数一(名称对应相同) "+name+" "+age);
        return "{'SpringMvc请求参数':'普通参数一名称对应相同'}";
    }

    @RequestMapping("/pt2")
    @ResponseBody
    public String pt2(@RequestParam("name") String n, int age){
        System.out.println("普通参数一(名称对应相同) "+n+" "+age);
        return "{'SpringMvc请求参数':'普通参数一名称对应相同'}";
    }
}
